Flow of Drug Classes Between Clinical Encounters in the Intervention Group. The Sankey diagram illustrates longitudinal transitions in medication class use across six successive clinical encounters among participants in the intervention group. Each vertical column represents one encounter (rx1 through rx6), and each colored node corresponds to a distinct drug class, including gastro‑motility agents, anti-infective agents, antidepressants, anxiolytics, antiallergics, proton pump inhibitors/H2 blockers (PPI/H2B), and an “other” category.
The width of each flow is proportional to the number of participants whose medication class changed or remained stable between encounters.
Early encounters (rx1–rx2) show substantial initiation of gastro‑motility agents and PPI/H2B therapies, while anti-infective and antiallergic agents appear less frequently. Across encounters, the “other” medication category remains a dominant pathway, indicating frequent transitions into heterogeneous or infrequently used drug classes.
By later encounters (rx5–rx6), gastro‑motility agents again form a major proportion of flows, suggesting recurrent or persistent prescribing patterns in this class.
The diagram highlights both persistence (e.g., continuing gastro‑motility therapy across multiple encounters) and variability in medication use, with numerous cross‑class transitions.
Similar graph for the control group is shown above. These graphs reveal distinct patterns in prescribing behavior and medication stability between the intervention (IBS-Smart, Trio-Smart, Combined IBS-Smart & Trio-Smart) and control groups.
Overall Pattern of Medication Transitions
Intervention Group:
The flows show more concentrated transitions, especially throughgastro‑motility agents,anti‑infective agents, andPPI/H2B classes.
The “other” medication category is consistently prominent but becomes especially dominant around rx3–rx5, indicating broad shifts into miscellaneous or less frequent drug classes.
Control Group:
The flows appear more diffuse, with a wider variety of medication classes represented (e.g.,antidiarrheal,analgesic).
Medications are more heterogeneous across encounters, suggesting less clustering into specific therapeutic classes.
from | to | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
analgesic | antiallergic | antidepressant | antidiarrheal | antiinfective | anxiolytic | gastromotility | other | ppi/h2b | Total | ||
analgesic | Count | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
Row pct | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 100.0% | 0.0% | ||
antiallergic | Count | 0 | 0 | 0 | 1 | 1 | 0 | 3 | 17 | 1 | 23 |
Row pct | 0.0% | 0.0% | 0.0% | 4.3% | 4.3% | 0.0% | 13.0% | 73.9% | 4.3% | ||
antidepressant | Count | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 5 | 2 | 10 |
Row pct | 0.0% | 0.0% | 10.0% | 0.0% | 10.0% | 10.0% | 0.0% | 50.0% | 20.0% | ||
antidiarrheal | Count | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
Row pct | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 100.0% | 0.0% | ||
antiinfective | Count | 1 | 0 | 0 | 0 | 7 | 1 | 12 | 10 | 2 | 33 |
Row pct | 3.0% | 0.0% | 0.0% | 0.0% | 21.2% | 3.0% | 36.4% | 30.3% | 6.1% | ||
anxiolytic | Count | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 5 | 0 | 7 |
Row pct | 0.0% | 0.0% | 0.0% | 0.0% | 14.3% | 0.0% | 14.3% | 71.4% | 0.0% | ||
gastromotility | Count | 0 | 6 | 2 | 0 | 4 | 0 | 21 | 30 | 9 | 72 |
Row pct | 0.0% | 8.3% | 2.8% | 0.0% | 5.6% | 0.0% | 29.2% | 41.7% | 12.5% | ||
other | Count | 4 | 9 | 6 | 0 | 14 | 5 | 14 | 189 | 9 | 250 |
Row pct | 1.6% | 3.6% | 2.4% | 0.0% | 5.6% | 2.0% | 5.6% | 75.6% | 3.6% | ||
ppi/h2b | Count | 0 | 6 | 0 | 0 | 1 | 1 | 1 | 13 | 1 | 23 |
Row pct | 0.0% | 26.1% | 0.0% | 0.0% | 4.3% | 4.3% | 4.3% | 56.5% | 4.3% | ||
Total | Count | 5 | 21 | 9 | 1 | 29 | 8 | 52 | 271 | 24 | 420 |
The transition matrix for the intervention group quantitatively supports the Sankey visualization. Consistent with the prominent ‘other’ nodes and thick connecting bands in the Sankey, ‘other’ was the most frequent destination class (271/420 transitions, ~64.5%) and showed high persistence (other→other: 189/250, 75.6%).
+ Gastro‑motility agents were also common and exhibited partial stability (gastro→gastro: 21/72, 29.2%) with frequent transitions to ‘other’ (gastro→other: 30/72, 41.7%) and to PPI/H2B (9/72, 12.5%).
+ Anti‑infective transitions often moved toward gastro‑motility (12/33, 36.4%) or ‘other’ (10/33, 30.3%), consistent with the cross‑class flows shown in the Sankey.
+ Differences between the table and figure largely reflect that the table pools transitions across all encounter intervals, whereas the Sankey displays encounter-specific flow patterns. The Sankey is “time-resolved”; the table is “time-collapsed”. If a transition occurs mostly early (e.g., rx1→rx2) but not later, the Sankey will show that timing. The table will average it into one number.
from | to | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
analgesic | antiallergic | antidepressant | antidiarrheal | antiinfective | anxiolytic | gastromotility | other | ppi/h2b | Total | ||
analgesic | Count | 1 | 2 | 0 | 0 | 0 | 0 | 2 | 10 | 1 | 16 |
Row pct | 6.2% | 12.5% | 0.0% | 0.0% | 0.0% | 0.0% | 12.5% | 62.5% | 6.2% | ||
antiallergic | Count | 1 | 1 | 2 | 0 | 0 | 1 | 4 | 23 | 6 | 38 |
Row pct | 2.6% | 2.6% | 5.3% | 0.0% | 0.0% | 2.6% | 10.5% | 60.5% | 15.8% | ||
antidepressant | Count | 1 | 1 | 0 | 0 | 0 | 1 | 2 | 13 | 2 | 20 |
Row pct | 5.0% | 5.0% | 0.0% | 0.0% | 0.0% | 5.0% | 10.0% | 65.0% | 10.0% | ||
antidiarrheal | Count | 0 | 0 | 0 | 0 | 1 | 2 | 1 | 5 | 0 | 9 |
Row pct | 0.0% | 0.0% | 0.0% | 0.0% | 11.1% | 22.2% | 11.1% | 55.6% | 0.0% | ||
antiinfective | Count | 0 | 0 | 1 | 1 | 8 | 0 | 7 | 14 | 3 | 34 |
Row pct | 0.0% | 0.0% | 2.9% | 2.9% | 23.5% | 0.0% | 20.6% | 41.2% | 8.8% | ||
anxiolytic | Count | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 9 | 4 | 16 |
Row pct | 12.5% | 6.2% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 56.2% | 25.0% | ||
gastromotility | Count | 0 | 5 | 3 | 2 | 4 | 2 | 12 | 34 | 6 | 68 |
Row pct | 0.0% | 7.4% | 4.4% | 2.9% | 5.9% | 2.9% | 17.6% | 50.0% | 8.8% | ||
other | Count | 14 | 18 | 8 | 3 | 20 | 9 | 18 | 232 | 22 | 344 |
Row pct | 4.1% | 5.2% | 2.3% | 0.9% | 5.8% | 2.6% | 5.2% | 67.4% | 6.4% | ||
ppi/h2b | Count | 1 | 8 | 4 | 1 | 3 | 2 | 4 | 27 | 5 | 55 |
Row pct | 1.8% | 14.5% | 7.3% | 1.8% | 5.5% | 3.6% | 7.3% | 49.1% | 9.1% | ||
Total | Count | 20 | 36 | 18 | 7 | 36 | 17 | 50 | 367 | 49 | 600 |
Medication transitions differed between groups. In the intervention group, movements into the “other” class were most frequent (64.5% of all transitions), with strong persistence within this category (other→other: 75.6%) and notable stability in gastro‑motility agents (gastro→gastro: 29.2%).
In contrast, the control group showed more heterogeneous switching patterns, including greater involvement of PPI/H2B and analgesic classes and lower stability within both “other” (67.4%) and gastro‑motility (17.6%).
Controls also exhibited more frequent transitions from and into PPI/H2B, whereas in the intervention group, anti‑infective agents more often shifted toward gastro‑motility (36.4% vs. 20.6%).
Overall, the transition matrices support the Sankey visualizations: the intervention group demonstrated more consistent medication trajectories, while the control group showed broader and less stable class‑to‑class movement.
In summary, compared with the intervention transition table, the controls show more PPI/H2B involvement, greater switching from gastro‑motility into “other,” and lower persistence within “other” and gastro‑motility. The intervention table shows greater continuity (especially other → other and gastro → gastro) and stronger anti‑infective → gastro‑motility transitions.
from | to | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
analgesic | antiallergic | antidepressant | antidiarrheal | antiinfective | anxiolytic | gastromotility | other | ppi/h2b | Total | ||
analgesic | Count | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
Row pct | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 100.0% | 0.0% | ||
antiallergic | Count | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 8 | 0 | 10 |
Row pct | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 20.0% | 80.0% | 0.0% | ||
antidepressant | Count | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 3 | 1 | 7 |
Row pct | 0.0% | 0.0% | 14.3% | 0.0% | 14.3% | 14.3% | 0.0% | 42.9% | 14.3% | ||
antidiarrheal | Count | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
Row pct | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 100.0% | 0.0% | ||
antiinfective | Count | 0 | 0 | 0 | 0 | 5 | 1 | 7 | 4 | 0 | 17 |
Row pct | 0.0% | 0.0% | 0.0% | 0.0% | 29.4% | 5.9% | 41.2% | 23.5% | 0.0% | ||
anxiolytic | Count | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
Row pct | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 100.0% | 0.0% | ||
gastromotility | Count | 0 | 2 | 2 | 0 | 3 | 0 | 17 | 19 | 8 | 51 |
Row pct | 0.0% | 3.9% | 3.9% | 0.0% | 5.9% | 0.0% | 33.3% | 37.3% | 15.7% | ||
other | Count | 3 | 3 | 4 | 0 | 6 | 0 | 8 | 112 | 6 | 142 |
Row pct | 2.1% | 2.1% | 2.8% | 0.0% | 4.2% | 0.0% | 5.6% | 78.9% | 4.2% | ||
ppi/h2b | Count | 0 | 4 | 0 | 0 | 1 | 0 | 0 | 9 | 1 | 15 |
Row pct | 0.0% | 26.7% | 0.0% | 0.0% | 6.7% | 0.0% | 0.0% | 60.0% | 6.7% | ||
Total | Count | 3 | 9 | 7 | 0 | 16 | 2 | 34 | 158 | 16 | 245 |
from | to | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
analgesic | antiallergic | antidepressant | antiinfective | anxiolytic | gastromotility | other | ppi/h2b | Total | ||
antiallergic | Count | 0 | 0 | 0 | 1 | 0 | 1 | 6 | 1 | 9 |
Row pct | 0.0% | 0.0% | 0.0% | 11.1% | 0.0% | 11.1% | 66.7% | 11.1% | ||
antidepressant | Count | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 3 |
Row pct | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 0.0% | 66.7% | 33.3% | ||
antiinfective | Count | 1 | 0 | 0 | 0 | 0 | 1 | 4 | 1 | 7 |
Row pct | 14.3% | 0.0% | 0.0% | 0.0% | 0.0% | 14.3% | 57.1% | 14.3% | ||
anxiolytic | Count | 0 | 0 | 0 | 1 | 0 | 1 | 4 | 0 | 6 |
Row pct | 0.0% | 0.0% | 0.0% | 16.7% | 0.0% | 16.7% | 66.7% | 0.0% | ||
gastromotility | Count | 0 | 2 | 0 | 1 | 0 | 2 | 5 | 0 | 10 |
Row pct | 0.0% | 20.0% | 0.0% | 10.0% | 0.0% | 20.0% | 50.0% | 0.0% | ||
other | Count | 1 | 4 | 2 | 4 | 5 | 2 | 58 | 3 | 79 |
Row pct | 1.3% | 5.1% | 2.5% | 5.1% | 6.3% | 2.5% | 73.4% | 3.8% | ||
ppi/h2b | Count | 0 | 1 | 0 | 0 | 1 | 1 | 3 | 0 | 6 |
Row pct | 0.0% | 16.7% | 0.0% | 0.0% | 16.7% | 16.7% | 50.0% | 0.0% | ||
Total | Count | 2 | 7 | 2 | 7 | 6 | 8 | 82 | 6 | 120 |
from | to | |||||||
|---|---|---|---|---|---|---|---|---|
antiallergic | antidiarrheal | antiinfective | gastromotility | other | ppi/h2b | Total | ||
antiallergic | Count | 0 | 1 | 0 | 0 | 3 | 0 | 4 |
Row pct | 0.0% | 25.0% | 0.0% | 0.0% | 75.0% | 0.0% | ||
antiinfective | Count | 0 | 0 | 2 | 4 | 2 | 1 | 9 |
Row pct | 0.0% | 0.0% | 22.2% | 44.4% | 22.2% | 11.1% | ||
gastromotility | Count | 2 | 0 | 0 | 2 | 6 | 1 | 11 |
Row pct | 18.2% | 0.0% | 0.0% | 18.2% | 54.5% | 9.1% | ||
other | Count | 2 | 0 | 4 | 4 | 19 | 0 | 29 |
Row pct | 6.9% | 0.0% | 13.8% | 13.8% | 65.5% | 0.0% | ||
ppi/h2b | Count | 1 | 0 | 0 | 0 | 1 | 0 | 2 |
Row pct | 50.0% | 0.0% | 0.0% | 0.0% | 50.0% | 0.0% | ||
Total | Count | 5 | 1 | 6 | 10 | 31 | 2 | 55 |
dt_test_prep <- dt_test_prep %>% mutate(ibssmart = case_when(is.na(ibs_smart)~0, TRUE~ibs_smart))
mod_matchibs <- matchit(ibssmart ~ age+ history_before_2019+MCAS_first_visit+IBS_D_first_visit+refer_y,
method = "nearest",
data = dt_test_prep)
summary(mod_matchibs)
##
## Call:
## matchit(formula = ibssmart ~ age + history_before_2019 + MCAS_first_visit +
## IBS_D_first_visit + refer_y, data = dt_test_prep, method = "nearest")
##
## Summary of Balance for All Data:
## Means Treated Means Control Std. Mean Diff. Var. Ratio
## distance 0.3529 0.2386 0.8266 0.8814
## age 48.5254 52.6250 -0.2626 0.7040
## history_before_2019 0.3390 0.6438 -0.6438 .
## MCAS_first_visit 0.0000 0.0688 -0.3179 .
## IBS_D_first_visit 0.0339 0.0625 -0.1580 .
## refer_y 0.7288 0.8500 -0.2726 .
## eCDF Mean eCDF Max
## distance 0.2111 0.3940
## age 0.0693 0.1787
## history_before_2019 0.3048 0.3048
## MCAS_first_visit 0.0688 0.0688
## IBS_D_first_visit 0.0286 0.0286
## refer_y 0.1212 0.1212
##
## Summary of Balance for Matched Data:
## Means Treated Means Control Std. Mean Diff. Var. Ratio
## distance 0.3529 0.3411 0.0852 1.1474
## age 48.5254 50.8475 -0.1488 0.8510
## history_before_2019 0.3390 0.3390 0.0000 .
## MCAS_first_visit 0.0000 0.0000 0.0000 .
## IBS_D_first_visit 0.0339 0.0508 -0.0937 .
## refer_y 0.7288 0.7458 -0.0381 .
## eCDF Mean eCDF Max Std. Pair Dist.
## distance 0.0164 0.1186 0.0886
## age 0.0395 0.0847 0.6548
## history_before_2019 0.0000 0.0000 0.1356
## MCAS_first_visit 0.0000 0.0000 0.0000
## IBS_D_first_visit 0.0169 0.0169 0.4683
## refer_y 0.0169 0.0169 0.3431
##
## Sample Sizes:
## Control Treated
## All 160 59
## Matched 59 59
## Unmatched 101 0
## Discarded 0 0
plot(mod_matchibs)
love.plot(mod_matchibs)
Figure presents a love plot summarizing covariate balance before (unadjusted; red) and after (adjusted; teal) the propensity-score–based adjustment for the IBS-Smart group and matched controls.
age, history_before_2019,
MCAS_first_visit, IBS_D_first_visit, and
refer_y_. In addition, the propensity score distance
measure showed substantial separation between groups (large positive
mean difference), consistent with strong baseline differences in
treatment assignment prior to adjustment.dt_test_prep <- dt_test_prep %>% mutate(triosmart_dv = case_when(is.na(trio_smart_dv)~0, TRUE~trio_smart_dv))
mod_matchts <- matchit(triosmart_dv ~ history_before_2019 +ibs_first_visit +SIBO_first_visit ,
method = "nearest", data = dt_test_prep)
summary(mod_matchts)
##
## Call:
## matchit(formula = triosmart_dv ~ history_before_2019 + ibs_first_visit +
## SIBO_first_visit, data = dt_test_prep, method = "nearest")
##
## Summary of Balance for All Data:
## Means Treated Means Control Std. Mean Diff. Var. Ratio
## distance 0.2416 0.1853 0.7072 0.832
## history_before_2019 0.4186 0.5966 -0.3608 .
## ibs_first_visit 0.0465 0.1534 -0.5076 .
## SIBO_first_visit 0.0698 0.1989 -0.5067 .
## eCDF Mean eCDF Max
## distance 0.1184 0.2797
## history_before_2019 0.1780 0.1780
## ibs_first_visit 0.1069 0.1069
## SIBO_first_visit 0.1291 0.1291
##
## Summary of Balance for Matched Data:
## Means Treated Means Control Std. Mean Diff. Var. Ratio
## distance 0.2416 0.2416 0 1
## history_before_2019 0.4186 0.4186 0 .
## ibs_first_visit 0.0465 0.0465 0 .
## SIBO_first_visit 0.0698 0.0698 0 .
## eCDF Mean eCDF Max Std. Pair Dist.
## distance 0 0 0
## history_before_2019 0 0 0
## ibs_first_visit 0 0 0
## SIBO_first_visit 0 0 0
##
## Sample Sizes:
## Control Treated
## All 176 43
## Matched 43 43
## Unmatched 133 0
## Discarded 0 0
plot(mod_matchts)
love.plot(mod_matchts)
Figure displays a covariate balance plot (love plot) comparing standardized mean differences between study groups before (unadjusted; red) and after (adjusted; teal) application of the propensity-score–based adjustment. The variables assessed include
history_before_2019,ibs_first_visit,SIBO_first_visit, and the propensity scoredistancemetric.